package common

import (
	"jlpay-sdk-go/pkg/jlpay/core"
	"jlpay-sdk-go/pkg/jlpay/models/trans/common"
	"jlpay-sdk-go/pkg/jlpay/services"
)

// ChnQueryService 渠道查询服务
type ChnQueryService struct {
	*services.BaseService
}

// NewChnQueryService 创建渠道查询服务
func NewChnQueryService(config *core.Config) *ChnQueryService {
	return &ChnQueryService{
		BaseService: services.NewBaseService(config),
	}
}

// ChnQuery 渠道查询
func (s *ChnQueryService) ChnQuery(request *common.ChnQueryRequest) (*common.ChnQueryResponse, error) {
	response := common.NewChnQueryResponse()
	err := s.Post(request, response, "/open/trans/chnquery")
	if err != nil {
		return nil, err
	}
	return response, nil
}
